package com.ifudata.dvp.app.api.app.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Service;
import com.ifudata.dvp.app.api.app.interfaces.IAppManageSV;
import com.ifudata.dvp.app.api.app.param.AppMenuRequest;
import com.ifudata.dvp.app.api.app.param.CollectAppMenusRequest;
import com.ifudata.dvp.app.api.app.param.ReportDetailRequest;
import com.ifudata.dvp.app.service.busi.interfaces.IAppDataBusiSV;
import com.ifudata.dvp.app.service.busi.interfaces.IAppManageBusiSV;
import com.ifudata.dvp.base.exception.BusinessException;
import com.ifudata.dvp.sdk.constant.ExceptionCodeConstant;

@Service
@Component
public class AppManageSVImpl implements IAppManageSV {

	@Autowired
	private IAppManageBusiSV appManageBusiSV;
	
	@Autowired
	private IAppDataBusiSV appDataBusiSV;

	@Override
	public String queryAppMenus(AppMenuRequest request) {
		if (request == null) {
			throw new BusinessException(ExceptionCodeConstant.PARAM_IS_NULL, "请求体不能为空");
		}
		return appManageBusiSV.queryAppMenus(request);
	}

	@Override
	public String queryCollectAppMenus(CollectAppMenusRequest request) {
		if( request==null ){
			throw new BusinessException(ExceptionCodeConstant.PARAM_IS_NULL, "请求体不能为空");
		}
		if( request.getStaffId()==null ){
			throw new BusinessException(ExceptionCodeConstant.PARAM_IS_NULL, "[staffId]不能为空");
		}
		return appManageBusiSV.queryCollectAppMenus(request);
	}

	@Override
	public String queryReportDetailData(ReportDetailRequest request) {
		if( request==null ){
			throw new BusinessException(ExceptionCodeConstant.PARAM_IS_NULL, "请求体不能为空");
		}
		if( request.getParentId()==null ){
			throw new BusinessException(ExceptionCodeConstant.PARAM_IS_NULL, "[parentId]不能为空");
		}
		if( request.getParam()==null ){
			return appDataBusiSV.getReportDetail(request.getParentId());
		}else{
			return appDataBusiSV.getReportDetail(request.getParentId(), request.getParam());
		}
	}
	
	
}
